package main

import (
	"fmt"
)

func main() {

	question11()
	question12()
	question2()
	question3()

}

// 1-1、打印九九乘法表。
func question11() {
	fmt.Println("1-1、打印九九乘法表:")
	fmt.Print(`
	1*1=1
	1*2=2 2*2=4
	1*3=3 2*3=6  3*3=9
	1*4=4 2*4=8  3*4=12 4*4=16
	1*5=5 2*5=10 3*5=15 4*5=20 5*5=25
	1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36
	1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49
	1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64
	1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81`)
}

// 1-2、打印九九乘法表
func question12() {
	fmt.Println()
	fmt.Println("\n1-2、打印九九乘法表:")
	fmt.Println()
	fmt.Printf("\t1*1=%-2v\n", 1*1)
	fmt.Printf("\t1*2=%-2v2*2=%-3v\n", 1*2, 2*2)
	fmt.Printf("\t1*3=%-2v2*3=%-3v3*3=%-3v\n", 1*3, 2*3, 3*3)
	fmt.Printf("\t1*4=%-2v2*4=%-3v3*4=%-3v4*4=%-3v\n", 1*4, 2*4, 3*4, 4*4)
	fmt.Printf("\t1*5=%-2v2*5=%-3v3*5=%-3v4*5=%-3v5*5=%-3v\n", 1*5, 2*5, 3*5, 4*5, 5*5)
	fmt.Printf("\t1*6=%-2v2*6=%-3v3*6=%-3v4*6=%-3v5*6=%-3v6*6=%-3v\n", 1*6, 2*6, 3*6, 4*6, 5*6, 6*6)
	fmt.Printf("\t1*7=%-2v2*7=%-3v3*7=%-3v4*7=%-3v5*7=%-3v6*7=%-3v7*7=%-3v\n", 1*7, 2*7, 3*7, 4*7, 5*7, 6*7, 7*7)
	fmt.Printf("\t1*8=%-2v2*8=%-3v3*8=%-3v4*8=%-3v5*8=%-3v6*8=%-3v7*8=%-3v8*8=%-3v\n", 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8)
	fmt.Printf("\t1*9=%-2v2*9=%-3v3*9=%-3v4*9=%-3v5*9=%-3v6*9=%-3v7*9=%-3v8*9=%-3v9*9=%-3v\n", 1*9, 2*9, 3*9, 4*9, 5*9, 6*9, 7*9, 8*9, 9*9)
	fmt.Println()
	fmt.Println("----------------------------------------------------------------------")
}

// 3、打印100以内的斐波那契数列
func question3() {
	a, b := 0, 1

	fmt.Print("3、斐波那契数列:")
	for a <= 100 {
		fmt.Print(" ", a)
		a, b = b, a+b
	}
	fmt.Println()

}
